package com.slz3.business.module.systemManagement.sysUser.domain;

import com.slz3.business.frame.functions.Add;
import com.slz3.business.frame.functions.Modify;
import com.slz3.business.module.systemManagement.sysOrganize.domain.SysOrganizeEntity;
import com.slz3.business.module.systemManagement.sysRole.domain.SysRoleEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.UUID;

@Entity
@Table(schema = "system_management", name = "sys_user", uniqueConstraints = {@UniqueConstraint(columnNames = "serName")})
@Data
@EqualsAndHashCode(callSuper = true)
public class SysUser extends SysUserEntity {

    @Transient
//    @NotNull(message = "ser1 必须非空!", groups = {Add.class, Modify.class})
//    @Length(min = 1, max = 255, message = "ser1 必须非空!", groups = {Add.class, Modify.class})
    private String serValid;

    @Transient
//    @NotNull(message = "ser2 必须非空!", groups = {Add.class, Modify.class})
//    @Length(min = 1, max = 255, message = "ser2 必须非空!", groups = {Add.class, Modify.class})
    private String serValid2;

    @Transient
    private SysOrganizeEntity sysOrganize;

    @Transient
    private List<SysRoleEntity> sysRoleEntities;

    @Transient
    @NotNull(message = "Please provide a valid role", groups = {Add.class, Modify.class})
    private List<UUID> roleUuids;

    @Transient
    private String loginToken;
}
